﻿package mortal.game.view.shopMall.data
{
    import Message.DB.Tables.*;
    import Message.Game.*;
    import mortal.game.cache.*;
    import mortal.game.resource.tableConfig.*;

    public class RebateItemData extends Object
    {
        public var remainInfo:SOnSellItem;
        public var playerInfo:SOnSellItemPlayer;

        public function RebateItemData()
        {
            return;
        }// end function

        public function get tShopPanicBuyItem() : TShopPanicBuyItem
        {
            return ShopConfig.instance.getRebatShopInfoByKey(Cache.instance.shop.curShopId + "_" + this.remainInfo.itemCode);
        }// end function

        public function get buyLimit() : int
        {
            var _loc_1:int = 0;
            if (this.tShopPanicBuyItem.buyLimit == 0)
            {
                return int.MAX_VALUE;
            }
            if (this.playerInfo)
            {
                _loc_1 = this.tShopPanicBuyItem.buyLimit - this.playerInfo.amount;
            }
            else
            {
                _loc_1 = this.tShopPanicBuyItem.buyLimit;
            }
            return _loc_1 > this.remainInfo.leftAmount ? (this.remainInfo.leftAmount) : (_loc_1);
        }// end function

    }
}
